﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace POS
{
    /// <summary>
    /// Interaction logic for AlcoholicDrinks.xaml
    /// </summary>
    public partial class AlcoholicDrinks : Window
    {
        double beerPrice = 2.00;
        double cubaLibrePrice = 3.00;
        double mojitoPrice = 4.00;
        double redWinePrice = 5.00;
        double whiskeyPrice = 6.00;
        double whiteWinePrice = 7.00;

        public AlcoholicDrinks()
        {
            InitializeComponent();
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void GoToOrdered(object sender, RoutedEventArgs e)
        {
            Ordered orderedMenu = new Ordered();
            orderedMenu.Show();
            this.Close();
        }


        private void ButtonBeer(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxBeerCount.Text != "0") && (this.TextBoxBeerCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxBeerCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Beer", beerPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonCubaLibre(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCubaLibreCount.Text != "0") && (this.TextBoxCubaLibreCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCubaLibreCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Cuba Libre", cubaLibrePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonMojito(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxMojitoCount.Text != "0") && (this.TextBoxMojitoCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxMojitoCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Mojito", mojitoPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonRedWine(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxRedWineCount.Text != "0") && (this.TextBoxRedWineCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxRedWineCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Red Wine", redWinePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonWhiskey(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxWhiskeyCount.Text != "0") && (this.TextBoxWhiskeyCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxWhiskeyCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Whiskey", whiskeyPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonWhiteWine(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxWhiteWineCount.Text != "0") && (this.TextBoxWhiteWineCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxWhiteWineCount.Text); i++)
                {
                    Table.orderList.Add(new Food("White Wine", whiteWinePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void RemoveCountBeerButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxBeerCount.Text == String.Empty)
            {
                this.TextBoxBeerCount.Text = "0";
            }

            if (int.Parse(this.TextBoxBeerCount.Text) > 0)
            {
                this.TextBoxBeerCount.Text = (int.Parse(this.TextBoxBeerCount.Text) - 1).ToString();
            }
        }

        private void AddCountBeerButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxBeerCount.Text == String.Empty)
            {
                this.TextBoxBeerCount.Text = "0";
            }
            this.TextBoxBeerCount.Text = (int.Parse(this.TextBoxBeerCount.Text) + 1).ToString();
        }

        private void RemoveCountCubaLibreButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCubaLibreCount.Text == String.Empty)
            {
                this.TextBoxCubaLibreCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCubaLibreCount.Text) > 0)
            {
                this.TextBoxCubaLibreCount.Text = (int.Parse(this.TextBoxCubaLibreCount.Text) - 1).ToString();
            }
        }

        private void AddCountCubaLibreButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCubaLibreCount.Text == String.Empty)
            {
                this.TextBoxCubaLibreCount.Text = "0";
            }
            this.TextBoxCubaLibreCount.Text = (int.Parse(this.TextBoxCubaLibreCount.Text) + 1).ToString();
        }

        private void RemoveCountMojitoButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxMojitoCount.Text == String.Empty)
            {
                this.TextBoxMojitoCount.Text = "0";
            }

            if (int.Parse(this.TextBoxMojitoCount.Text) > 0)
            {
                this.TextBoxMojitoCount.Text = (int.Parse(this.TextBoxMojitoCount.Text) - 1).ToString();
            }
        }

        private void AddCountMojitoButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxMojitoCount.Text == String.Empty)
            {
                this.TextBoxMojitoCount.Text = "0";
            }
            this.TextBoxMojitoCount.Text = (int.Parse(this.TextBoxMojitoCount.Text) + 1).ToString();
        }

        private void RemoveCountRedWineButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxRedWineCount.Text == String.Empty)
            {
                this.TextBoxRedWineCount.Text = "0";
            }

            if (int.Parse(this.TextBoxRedWineCount.Text) > 0)
            {
                this.TextBoxRedWineCount.Text = (int.Parse(this.TextBoxRedWineCount.Text) - 1).ToString();
            }
        }

        private void AddCountRedWineButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxRedWineCount.Text == String.Empty)
            {
                this.TextBoxRedWineCount.Text = "0";
            }
            this.TextBoxRedWineCount.Text = (int.Parse(this.TextBoxRedWineCount.Text) + 1).ToString();
        }

        private void RemoveCountWhiskeyButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWhiskeyCount.Text == String.Empty)
            {
                this.TextBoxWhiskeyCount.Text = "0";
            }

            if (int.Parse(this.TextBoxWhiskeyCount.Text) > 0)
            {
                this.TextBoxWhiskeyCount.Text = (int.Parse(this.TextBoxWhiskeyCount.Text) - 1).ToString();
            }
        }

        private void AddCountWhiskeyButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWhiskeyCount.Text == String.Empty)
            {
                this.TextBoxWhiskeyCount.Text = "0";
            }
            this.TextBoxWhiskeyCount.Text = (int.Parse(this.TextBoxWhiskeyCount.Text) + 1).ToString();
        }

        private void RemoveCountWhiteWineButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWhiteWineCount.Text == String.Empty)
            {
                this.TextBoxWhiteWineCount.Text = "0";
            }

            if (int.Parse(this.TextBoxWhiteWineCount.Text) > 0)
            {
                this.TextBoxWhiteWineCount.Text = (int.Parse(this.TextBoxWhiteWineCount.Text) - 1).ToString();
            }
        }

        private void AddCountWhiteWineButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWhiteWineCount.Text == String.Empty)
            {
                this.TextBoxWhiteWineCount.Text = "0";
            }
            this.TextBoxWhiteWineCount.Text = (int.Parse(this.TextBoxWhiteWineCount.Text) + 1).ToString();
        }
    }
}
